package com.marketing.auth.dto;

import java.util.List;

/**
 * 分页结果DTO
 */
public class PageResult<T> {
    
    private List<T> records; // 当前页数据
    private Long total; // 总记录数
    private Long size; // 每页大小
    private Long current; // 当前页码
    private Long pages; // 总页数
    
    public PageResult() {}
    
    public PageResult(List<T> records, Long total, Long current, Long size) {
        this.records = records;
        this.total = total;
        this.current = current;
        this.size = size;
        this.pages = total > 0 ? (total + size - 1) / size : 0;
    }

    // Getters and Setters
    public List<T> getRecords() {
        return records;
    }

    public void setRecords(List<T> records) {
        this.records = records;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }

    public Long getCurrent() {
        return current;
    }

    public void setCurrent(Long current) {
        this.current = current;
    }

    public Long getPages() {
        return pages;
    }

    public void setPages(Long pages) {
        this.pages = pages;
    }

    @Override
    public String toString() {
        return "PageResult{" +
                "total=" + total +
                ", size=" + size +
                ", current=" + current +
                ", pages=" + pages +
                ", recordsSize=" + (records != null ? records.size() : 0) +
                '}';
    }
}